<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*,
				 com.kylin.common.*,
				 com.kylin.common.util.*,
				 com.kylin.common.paginate.*,
				 com.kylin.module.shop.orm.*"%>
<%@ include file="/common/include/taglibs.jsp"%>
<%@ include file="/common/include/pageExpires.jsp"%>
<%@ include file="/common/include/dictNames.jsp"%>
<table width="90%" border="0" align="center">
	<tr>
		<td align="left">
			商城管理→供求信息维护→供求信息列表
		</td>
	</tr>
</table>
<%
    String currLanguage = request.getParameter("language");
    if(currLanguage == null)
        currLanguage = sessionLocale.toString();
%>
<script>
function changeLanguage(lang){
    location.replace('/admin/shop/manageTrade.do?CMD=manageTradeList&language='+lang);
}
</script>
<p>
	&nbsp;
</p>
<p>
	&nbsp;
</p>
<form action="/admin/shop/manageTrade.do?CMD=manageTradeList" method="post" >
<table width="90%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="22" align="right">
			信息类型：
		</td>
		<td align="left">
      		<input name="keyword_type" type="radio" value="<%=Content.TYPE_SELL %>" checked>出售
      		<input name="keyword_type" type="radio" value="<%=Content.TYPE_BUY %>">收购
		</td>
	</tr>
	<tr>
		<td height="22" align="right">
			投放语言：
		</td>
		<td align="left">
      				<mytag:national name="language" onchange="changeLanguage(this.value)" dictName="<%=Constants.SYSLANGUAGE%>" />
		</td>
	</tr>
	<tr>
          <td height="22" align="right">
          	所属分类：
          </td>
          <td align="left">               
			<% 
					List maincatproduct = MemObjFactory.getDict("产品类别",currLanguage);
		            boolean disableSelectParent = false; 
		            out.println(JspHelper.getCatProductSelect(maincatproduct,"catproduct",disableSelectParent));
		     %>
              </td>
        </tr>
   <tr>
          <td height="22" align="right">
          	投放国家：
          </td>
          <td align="left">
      		<mytag:national name="keyword_country" dictName="<%=Constants.ALLCOUNTRY%>"/>
           </td>
    </tr>
	<tr>
		<td height="18" align="right">
			用户名：
		</td>
		<td align="left">
			<input type="text" name="keyword_username" />
		</td>
	</tr>
	<tr>
		<td height="18" align="right">
			关键字：
		</td>
		<td align="left">
			<input type="text" name="keyword_title" />
		</td>
	</tr>
	<tr>
		<td height="29" align="right"> &nbsp; </td>
		<td>
			<input name="button2" type="submit" value="查询" />
		</td>
	</tr>
</table>
</form>
<br />
<script>
    function deleteOne(delUrl){
        if(confirm("确定要删除此条数据吗？") ){
            location.href = delUrl ;
        }
    }
</script>
<mytag:MyActionMsg />
<table width="90%" border="0" align="center">
  <tr>
    <td>汉语 & 英语</td>
  </tr>
</table>
<table class='pageTable' cellspacing='0' cellpadding='0'>
  <tr>
    	<td class='pageTitle'>ID号</td>
    	<td class='pageTitle'>类型</td>
        <td class='pageTitle'>国家</td>
        <td class='pageTitle'>用户</td>
        <td class='pageTitle'>分类</td>
        <td class='pageTitle'>标题</td>
        <td class='pageTitle'>操作</td>
  </tr>
<%
	DisplayPage dispage = null;
    if(request.getAttribute(Constants.KEY_REQUEST_RESULT )!=null){
        dispage = (DisplayPage)request.getAttribute(Constants.KEY_REQUEST_RESULT);
        String deleteUrl = "/admin/shop/manageTrade.do?CMD=tradeDelete&page="
		+ dispage.getPageNumber()
		+ "&searchId="
		+ dispage.getSearchId();
		String detailUrl = "/admin/shop/manageTrade.do?CMD=tradeDetail&id=";
		for (int i = 0; i < dispage.getList().size(); i++) {
			Content obj = (Content) dispage.getList().get(i);
			String username = "";
			if(obj.getCompany() != null){
				username = obj.getCompany().getUser().getUsername();
			}else{
				username = "magickylin";
			}
%>
		  <tr class='row<%=(i % 2)%>'>
		    <td class='pageTd'><%=(i+1)%></td>
		    <td class='pageTd'>
		    <%
		    		if(Content.TYPE_SELL.equals(obj.getType()))
		    				out.println("出售");
		    		if(Content.TYPE_BUY.equals(obj.getType()))
		    			 	out.println("收购"); 
		    %>
		    </td>
		    <td class='pageTd'><%=UTool.getCountryName(obj.getCountry(),sessionLocale)%></td>
		    <td class='pageTd'><%=username%></td>
		    <td class='pageTd'><%=(obj.getCatproduct()!=null)?obj.getCatproduct().getName():""%></td>
		    <td class='pageTd'>&nbsp; 
		    	<a href="<%=detailUrl + obj.getId()%>">
		    		[<%=UTool.getLanguageName(obj.getLanguage(),sessionLocale) %>]
					<%=obj.getTitle() %>
				</a>
			</td>
		    <td class='pageTd'>
		         <a href="<%=deleteUrl + "&id=" +obj.getId()%>" >删除</a>
		    </td>
		  </tr>
<%
        }
    }
%>  
</table>
<%
     //调用共通方法生成翻页工具条
	 out.print(JspHelper.getPageBar(dispage,request.getRequestURL()+"?CMD=manageTradeList"));

%>
